Skip to content

Conversation

@leochiu-a
Copy link
Owner

@leochiu-a leochiu-a commented Nov 26, 2025

Summary

This PR refactors the codebase by renaming closeWatcher to closeHandler for better naming consistency and consolidates settings management by merging SettingsStore into ShowSettings. These changes improve code organization and reduce unnecessary abstractions while maintaining the same functionality.

Key Changes

  • Renamed module: closeWatcher.tscloseHandler.ts for naming consistency with other handler modules (mergeHandler, createHandler, approveHandler)
  • Renamed function: waitForCloseComplete()waitForCloseCompletion() for better semantic clarity
  • Consolidated settings management: Merged SettingsStore class into ShowSettings, eliminating an unnecessary layer of abstraction
  • Extracted constants: Created constants.ts to store timeout and delay values (CLOSE_DETECTION_TIMEOUT_MS, CLOSE_EXISTING_CHECK_DELAY_MS)
  • Refactored close detection logic: Moved close completion watching logic from standalone module into closeHandler.ts with improved encapsulation
  • Updated state management: ShowSettings now directly manages Chrome storage sync operations instead of delegating to SettingsStore

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • ♻️ Refactoring (no functional changes)
  • 🎨 Style/formatting changes
  • 🧪 Test improvements
  • 🔧 Configuration changes

Test Plan

Manual Testing

  • Verify that PR close detection still works correctly when clicking the "Close pull request" button
  • Confirm that the extension settings are properly loaded from Chrome storage
  • Test that settings changes are reflected in real-time across different PR events
  • Validate that timeout behavior for close detection remains unchanged (10 seconds timeout, 100ms initial check)

Breaking Changes

None

Checklist

  • 📝 Code follows the style guidelines
  • 👀 Self-review has been performed
  • 🧪 Tests have been added/updated
  • 📖 Documentation has been updated

@leochiu-a leochiu-a merged commit 072bfb8 into main Nov 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants